package com.game.league.task.detail.adapter;

import android.app.Activity;

import com.game.base.app.base.BaseAdapter;
import com.game.base.app.callback.ItemOnClick;
import com.game.base.glideV4.ImageLoader;
import com.game.base.server.file.qiniulibrary.UploadType;
import com.game.base.utils.DisplayUtils;
import com.game.league.R;
import com.game.league.databinding.AdapterExampleImgBinding;

/**
 * Created by Su on 2019/6/6.
 */
public class ExampleImgAdapter extends BaseAdapter<String, AdapterExampleImgBinding> {
    private int type;  // 1=步骤详情   2=上传截图示例;

    public ExampleImgAdapter(Activity activity, int type, ItemOnClick itemOnClick) {
        super(activity, itemOnClick);
        this.type = type;
    }

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.adapter_example_img;
    }

    @Override
    protected void onBindItem(AdapterExampleImgBinding binding, String item, int position) {
        ImageLoader.loadRoundCenterCrop(mActivity, UploadType.UPLOAD_URL + item, binding.ivImage);
        if (type == 1) {
            binding.tvNum.setText(String.valueOf(position + 1));
            binding.tvNum.setTextSize(DisplayUtils.sp2px(mActivity, 12));
            return;
        }

        if (type == 2) {
            binding.tvNum.setText("示例");
            binding.tvNum.setTextSize(DisplayUtils.sp2px(mActivity, 7));
        }
    }
}
